﻿@{
    Layout = null;
}

<link href="~/Scripts/Bootstrap/css/bootstrap-datepicker3.min.css" rel="stylesheet" />
<script src="~/Scripts/Bootstrap/js/bootstrap-datepicker.js"></script>

 
<script src="~/Scripts/tableTree/TableTree4J.js"></script>
<link href="~/Content/Manger/tabletree4j.css" rel="stylesheet" />
<div class="mtlr15">
    <form id="SearchForm" role="form" onkeydown="if(event.keyCode==13){return false;}">
        <div class="row">
            <div class="col-lg-8 col-md-8 col-sm-8" style="padding:0">
                <button type="button" class="btn btn-success" onclick="$.MGJ.RoleManage.Dialog_AddRole()">
                    <i class="glyphicon glyphicon-plus"></i>
                    新增
                </button>
                @*<button type="button" class="btn btn-success">
                        <i class="glyphicon glyphicon-arrow-down"></i>
                        导入excel
                    </button>*@
                <button type="button" class="btn btn-success" onclick="$.MGJ.RoleManage.ExportE('#RoleInfo')">
                    <i class="glyphicon glyphicon-share-alt"></i>
                    导出excel
                </button>
            </div>
            <div class="col-lg-4 col-md-4 col-sm-4">
                <div class="input-group">
                    <div style="width:100%;display:none"></div>
                    <input class="form-control" id="RoleName" name="RoleName" type="text" placeholder="角色名称" onkeydown="if (event.keyCode == 13) { $.MGJ.RoleManage.Ajax_GetRoleInfo(1); }">
                    <span class="input-group-addon" onclick="$.MGJ.RoleManage.Ajax_GetRoleInfo(1);">
                        <span class="glyphicon glyphicon-search"></span>
                    </span>
                    <div class="input-group-btn" style="margin-left:1px;" onclick="detailSearch(this)">
                        <button type="button" class="btn btn-default" style="border: 1px solid transparent;">
                            更多搜索
                            <span class="caret"></span>
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <div class="detail-search-con" style="display:none">
            <div class="row newrow">
                <div class="col-lg-1 col-md-1 col-sm-1 col-lg-offset-1 col-md-offset-1 col-sm-offset-1 text-right" style="padding:0">
                    开始时间
                </div>
                <div class="col-lg-2 col-md-2 col-sm-2">
                    <input id="StartDate" type="text" name="StartDate" class="form-control" placeholder="开始时间" />
                </div>
                <div class="col-lg-1 col-md-1 col-sm-1 col-sm-2 text-right" style="padding:0">
                    结束时间
                </div>

                <div class="col-lg-2 col-md-2 col-sm-2 col-sm-3">
                    <input id="EndDate" type="text" name="EndDate" class="form-control" placeholder="结束时间" />
                </div>
            </div>
            <div class="row newrow">
                <div class="col-lg-1 col-md-1 col-sm-1 col-lg-offset-1 col-md-offset-1 col-sm-offset-1 text-right" style="padding:0">
                    机构名称
                </div>
                <div class="col-lg-2 col-md-2 col-sm-2">
                    <input type="text" name="EnterpriseName" class="form-control" placeholder="关联机构名称" />
                </div>
                <div class="col-lg-1 col-md-1 col-sm-1 col-sm-2 text-right" style="padding:0">
                    角色类型
                </div>
                <div class="col-lg-2 col-md-2 col-sm-2 col-sm-2">

                    <select class="form-control" name="RoleType">
                        <option value="">请选择</option>
                        <option value="0">系统预定义</option>
                        <option value="1">企业自定义</option>

                    </select>
                </div>
                <div class="col-lg-2 col-md-2 col-sm-2 col-sm-2 text-center">
                    <button type="button" class="btn btn-default" style="margin-left:23px;" onclick="$.MGJ.RoleManage.Ajax_GetRoleInfo(1);">
                        <span class="glyphicon glyphicon-search"></span>
                        搜索
                    </button>
                    <button type="reset" class="btn btn-default">
                        重置
                    </button>
                </div>
            </div>
        </div>
    </form>
    <div id="Table">
        <div class="overflow">
            <table class="table table-hover table-bordered">
                <thead>
                    <tr>
                        <th width="30px"><input class="AllClickCheckbox" type="checkbox"></th>
                        <th>角色名称</th>
                        <th>角色类型</th>
                        <th>关联机构类型</th>
                        @*<th>操作时间</th>*@
                        <th>备注</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody id="RoleInfo" style="display:none;" binding="{'pageId':'ShoppingPager','pageCallback':'$.MGJ.RoleManage.Ajax_GetRoleInfo','emptyHtml':Role_EmptyHtml}">

                    <tr>
                        <td width="15"><input type="checkbox" class="AllClickChild" binding="{'ID':'ID'}"></td>
                        <td binding="{'text':'RoleName','title':'RoleName'}"></td>
                        <td class="RoleType" binding="{'text':'RoleType','title':'RoleType'}"></td>
                        <td binding="{'text':'EnterpriseName','title':'EnterpriseName'}"></td>
                        @*<td binding="{'text':'ChangeDate','textHandle':'datetime'}"></td>*@
                       
                        <td binding="{'text':'Remark','title':'Remark'}"></td>
                        <td>
                            <a class="cursor changeText" changetext="@ViewBag.UserId" binding="{'RoleID':'ID','Type':'RoleType'}" onclick="$.MGJ.RoleManage.Dialog_ConfigCompetence(this)">配置权限</a>
                            <a class="cursor EDRoleType" binding="{'RoleID':'ID','Type':'RoleType'}" onclick="$.MGJ.RoleManage.Dialog_EditRole(this)">编辑</a>
                            <a class="cursor EDRoleType" binding="{'RoleID':'ID','Type':'RoleType'}" onclick="$.MGJ.RoleManage.Ajax_DeleteRoleInfo(this)">删除</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div id="ShoppingPager"></div>
    </div>
</div>
@Content.Script(Url, "Manager/RoleManage.js")
<script>
    $("#StartDate").datepicker({
        format: "yyyy-mm-dd",
        language: 'cn',
        todayBtn: "linked",
        autoclose: true,
        todayHighlight: true,
        endDate: new Date()
    }).on('changeDate', function (e) {
        var startTime = e.date;
        $('#EndDate').datepicker('setStartDate', startTime);
    });
    $("#EndDate").datepicker({
        format: "yyyy-mm-dd",
        language: 'cn',
        todayBtn: "linked",
        autoclose: true,
        todayHighlight: true,
        endDate: new Date()
    }).on('changeDate', function (e) {
        var endTime = e.date;
        $('#StartDate').datepicker('setEndDate', endTime);
    });

    var ColspanNub = $(".table.table-hover.table-bordered").find("tr").children("td").length
    window.Role_EmptyHtml = '<tr><td colspan="' + ColspanNub + '"><p class="no-result">无符合条件的数据结果</p></td></tr>';

    $(function () {
        $.MGJ.RoleManage.Ajax_GetRoleInfo(1);
    });
    
    $(function () {
        $('#SearchForm').bootstrapValidator({
            fields: {
                ProductName: {
                    validators: {
                        regexp: {
                            regexp: /^[a-zA-Z\u4e00-\u9fa5]+$/,
                            message: '角色名称不能输入符号和数字'
                        }
                    }
                },
                CheckStatus: {
                    validators: {
                        regexp: {
                            regexp: /^[a-zA-Z\u4e00-\u9fa5]+$/,
                            message: '角色类型不能输入符号和数字'
                        }
                    }
                }
            }
        });
    })
</script>